﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using VTNT.Framework.Service;
using VTNT.DataLayer.DataObject.Core;
using VTNT.Service.Data.Sys;
namespace VTNT.Service.Data.Core
{
    public class CCoreService
    {
        public string Login(string ClientKey, string inputValue)
        {
            inputValue = CDataControler.HtmlDecode(inputValue);
            if (CDataControler.ValidateRequest(inputValue))
            {
                DataSet ds = new CCoreDao().Login(ClientKey, inputValue);
                return CDataParser.DataSetToCSV(ds);
            }
            return "Access Denied";
        }
        public string ActionUser(string ClientKey, string inputValue)
        {
            inputValue = CDataControler.HtmlDecode(inputValue);
            if (CDataControler.ValidateRequest(inputValue))
            {
                DataSet ds = new CCoreDao().ActionUser(ClientKey, inputValue);
                return CDataParser.DataSetToCSV(ds);
            }
            return "Access Denied";

        }

        public string GetResource(string ClientKey, string inputValue)
        {
            inputValue = CDataControler.HtmlDecode(inputValue);
            if (CDataControler.ValidateRequest(inputValue))
            {
                DataSet ds = new CCoreDao().GetResource(ClientKey, inputValue);
                return CDataParser.DataSetToCSV(ds);
            }
            return "Access Denied";
        }
        public string ActionResource(string ClientKey, string inputValue)
        {
            inputValue = CDataControler.HtmlDecode(inputValue);
            if (CDataControler.ValidateRequest(inputValue))
            {
                DataSet ds = new CCoreDao().ActionResource(ClientKey, inputValue);
                return CDataParser.DataSetToCSV(ds);
            }
            return "Access Denied";
        }
        public string GetData(string ClientKey, string inputValue)
        {
            inputValue = CDataControler.HtmlDecode(inputValue);
            if (CDataControler.ValidateRequest(inputValue))
            {
                DataSet ds = new CCoreDao().GetData(ClientKey, inputValue);
                return CDataParser.DataSetToCSV(ds);
            }
            return "Access Denied";
        }
        public string ActionData(string ClientKey, string inputValue)
        {
            inputValue = CDataControler.HtmlDecode(inputValue);
            if (CDataControler.ValidateRequest(inputValue))
            {
                DataSet ds = new CCoreDao().ActionData(ClientKey, inputValue);
                return CDataParser.DataSetToCSV(ds);
            }
            return "Access Denied";
        }
        public string GetContextData(string ClientKey, string inputValue)
        {
            inputValue = CDataControler.HtmlDecode(inputValue);
            if (CDataControler.ValidateRequest(inputValue))
            {
                DataSet ds = new CCoreDao().GetContextData(ClientKey, inputValue);
                return CDataParser.DataSetToCSV(ds);
            }
            return "Access Denied";
        }
    }
}